package com.gzy.rpsm_admin.config;

import com.gzy.rpsm_admin.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class AdminWebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry)
    {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/**") // 需要拦截的路径,/**拦 截所有路径，包括静态资源
            .excludePathPatterns("/","/admin/login","/doc.html",
                    "/error","/swagger**/**","/webjars/**","/v3/**"); //不需要拦截的路径
    }
}
